The weeb for the next gen discord boat - Wamellow
wamellow.com
bot
discord
1import { Faq } from "@/app/(home)/faq.component";
2import BeautifyMarkdown from "@/components/markdown";
3import Notice, { NoticeType } from "@/components/notice";
4import { ScreenMessage } from "@/components/screen-message";
5import { Badge } from "@/components/ui/badge";
6import metadata from "@/public/docs/meta.json";
7import { readFile } from "fs/promises";
8
9interface Props {
10 params: Promise<{ pathname: string[]; }>;
11}
12
13const PATH = `${process.cwd()}/public/docs` as const;
14
15export default async function Home({ params }: Props) {
16 const { pathname } = await params;
17 const markdown = await readFile(`${PATH}/${pathname.join("/").toLowerCase()}.md`, "utf-8").catch(() => null);
18 const meta = metadata.pages.find((page) => page.file === `${pathname.join("/").toLowerCase()}.md`);
19
20 if (!markdown || !meta) {
21 return (
22 <ScreenMessage
23 top="6rem"
24 title="Sadly, this page can not be found.."
25 description="Seems like you got a little lost here? Here's wumpus for now!"
26 />
27 );
28 }
29
30 return (
31 <article
32 itemType="http://schema.org/Article"
33 className="w-full lg:w-3/4"
34 >
35 {meta?.permissions?.bot && (
36 <Notice
37 type={NoticeType.Info}
38 message="Wamellow requires permissions"
39 >
40 <div className="space-x-1">
41 {meta.permissions.bot.map((perm) => (
42 <Badge
43 key={perm}
44 className="-my-1"
45 variant="flat"
46 >
47 {perm}
48 </Badge>
49 ))}
50 </div>
51 </Notice>
52 )}
53
54 <BeautifyMarkdown markdown={markdown} />
55
56 <div className="h-16" />
57
58 <Faq showTitle />
59 </article>
60 );
61}